package com.example.demo.config;

import com.example.demo.interceptor.TraceIdIdHandlerInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 拦截器配置
 *
 * @author renliang
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    /**
     * 日志跟踪设置请求唯一ID
     *
     * @param interceptorRegistry 注册器
     */
    @Override
    public void addInterceptors(InterceptorRegistry interceptorRegistry) {
        interceptorRegistry.addInterceptor(new TraceIdIdHandlerInterceptor());
    }

}
